#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:

    string compressString(string param) {
        string ret;
        int n = 0;
        char c = 0;
        for (auto ch : param) {
            if (c != ch) {
                if (n == 1) ret.push_back(c);
                else if (n > 1) {
                    string i = to_string(n);
                    ret.push_back(c);
                    for (auto in : i) ret.push_back(in);
                }
                c = ch;
                n = 1;
            }
            else {
                n++;
            }
        }
        if (n == 1) ret.push_back(c);
        else if (n > 1) {
            string i = to_string(n);
            ret.push_back(c);
            for (auto in : i) ret.push_back(in);
        }
        return ret;
    }
};